/*
 * ! ******************************************************************************
 *
 * Pentaho Data Integration
 *
 * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com
 *
 *******************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 ******************************************************************************/

package org.pentaho.di.ui.trans.dialog;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.extension.ExtensionPointHandler;
import org.pentaho.di.core.extension.KettleExtensionPoint;
import org.pentaho.di.core.logging.DefaultLogLevel;
import org.pentaho.di.core.logging.LogLevel;
import org.pentaho.di.core.util.Utils;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.trans.TransExecutionConfiguration;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.ui.core.dialog.ConfigurationDialog;
import org.pentaho.di.ui.core.dialog.ErrorDialog;
import org.pentaho.di.ui.core.gui.GUIResource;
import org.pentaho.di.ui.spoon.Spoon;

public class TransExecutionConfigurationDialog extends ConfigurationDialog {
    private static Class<?> PKG = TransExecutionConfigurationDialog.class; // for i18n purposes, needed by Translator2!!

    public TransExecutionConfigurationDialog(Shell parent, TransExecutionConfiguration configuration,
        TransMeta transMeta) {
        super(parent, configuration, transMeta);
    }

    protected void serverOptionsComposite(Class<?> PKG, String prefix) {

    }

    protected void optionsSectionControls() {
        wClearLog = new Button(gDetails, SWT.CHECK);
        wClearLog.setText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.ClearLog.Label"));
        wClearLog.setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.ClearLog.Tooltip"));
        props.setLook(wClearLog);
        FormData fdClearLog = new FormData();
        fdClearLog.top = new FormAttachment(0, 10);
        fdClearLog.left = new FormAttachment(0, 10);
        wClearLog.setLayoutData(fdClearLog);

        wSafeMode = new Button(gDetails, SWT.CHECK);
        wSafeMode.setText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.SafeMode.Label"));
        wSafeMode.setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.SafeMode.Tooltip"));
        props.setLook(wSafeMode);
        FormData fdSafeMode = new FormData();
        fdSafeMode.top = new FormAttachment(wClearLog, 7);
        fdSafeMode.left = new FormAttachment(0, 10);
        wSafeMode.setLayoutData(fdSafeMode);

        wGatherMetrics = new Button(gDetails, SWT.CHECK);
        wGatherMetrics.setText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.GatherMetrics.Label"));
        wGatherMetrics
            .setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.GatherMetrics.Tooltip"));
        props.setLook(wGatherMetrics);
        FormData fdGatherMetrics = new FormData();
        fdGatherMetrics.top = new FormAttachment(wSafeMode, 7);
        fdGatherMetrics.left = new FormAttachment(0, 10);
        fdGatherMetrics.bottom = new FormAttachment(100, -10);
        wGatherMetrics.setLayoutData(fdGatherMetrics);

        wlLogLevel = new Label(gDetails, SWT.NONE);
        props.setLook(wlLogLevel);
        wlLogLevel.setText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.LogLevel.Label"));
        wlLogLevel.setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.LogLevel.Tooltip"));
        FormData fdlLogLevel = new FormData();
        fdlLogLevel.top = new FormAttachment(0, 10);
        fdlLogLevel.left = new FormAttachment(27, 0);
        wlLogLevel.setLayoutData(fdlLogLevel);

        wLogLevel = new CCombo(gDetails, SWT.READ_ONLY | SWT.BORDER);
        wLogLevel.setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.LogLevel.Tooltip"));
        props.setLook(wLogLevel);
        FormData fdLogLevel = new FormData();
        fdLogLevel.top = new FormAttachment(wlLogLevel, -2, SWT.TOP);
        fdLogLevel.width = 185;
        fdLogLevel.left = new FormAttachment(wlLogLevel, 5);
        wLogLevel.setLayoutData(fdLogLevel);
        wLogLevel.setItems(LogLevel.getLogLevelDescriptions());

        // wThreadPool = new Button(gDetails, SWT.CHECK);
        // wThreadPool.setText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.ThreadPool.Label"));
        // wThreadPool.setToolTipText(BaseMessages.getString(PKG,
        // "TransExecutionConfigurationDialog.ThreadPool.Tooltip"));
        // props.setLook(wThreadPool);
        // FormData fdThreadPool = new FormData();
        // fdThreadPool.top = new FormAttachment(wlLogLevel, 7);
        // fdThreadPool.left = new FormAttachment(27, 0);
        // wThreadPool.setLayoutData(fdThreadPool);
        // wThreadPool.addSelectionListener(new SelectionListener() {
        //
        // @Override
        // public void widgetSelected(SelectionEvent paramSelectionEvent) {
        // // TODO Auto-generated method stub
        // if (wThreadPool.getSelection()) {
        // wThreadPoolLevel.select(0);
        // wThreadPoolLevel.setEnabled(true);
        // wlPerformanceLevel.setEnabled(true);
        // wPerformanceLevel.select(0);
        // wPerformanceLevel.setEnabled(true);
        // } else {
        // wThreadPoolLevel.deselectAll();
        // wThreadPoolLevel.setEnabled(false);
        // wlPerformanceLevel.setEnabled(false);
        // wPerformanceLevel.deselectAll();
        // wPerformanceLevel.setEnabled(false);
        // wThreadNum.setText("");
        // wThreadNum.setVisible(false);
        // }
        //
        // }
        //
        // @Override
        // public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) {
        // // TODO Auto-generated method stub
        // }
        // });
        ////
        //// wThreadPoolLevel = new CCombo(gDetails, SWT.READ_ONLY | SWT.BORDER);
        //// wThreadPoolLevel
        //// .setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.ThreadPool.Level.Label"));
        //// props.setLook(wThreadPoolLevel);
        //// FormData fdPoolLevel = new FormData();
        //// fdPoolLevel.top = new FormAttachment(wlLogLevel, 5);
        //// fdPoolLevel.width = 105;
        //// fdPoolLevel.left = new FormAttachment(wThreadPool, 5);
        //// wThreadPoolLevel.setLayoutData(fdPoolLevel);
        //// wThreadPoolLevel.setItems(EtlThreadPool.threadPoolLevelWords);
        //// wThreadPoolLevel.addSelectionListener(new SelectionListener() {
        ////
        //// @Override
        //// public void widgetSelected(SelectionEvent paramSelectionEvent) {
        //// // TODO Auto-generated method stub
        //// if (wThreadPoolLevel.getSelectionIndex() == EtlThreadPool.fixedThreadPool) {// 判断是否选择了定长线程池
        //// wThreadNum.setVisible(true);
        //// } else {
        //// wThreadNum.setVisible(false);
        //// wThreadNum.setText("");
        //// }
        //// }
        ////
        //// @Override
        //// public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) {
        //// // TODO Auto-generated method stub
        //// }
        //// });
        //
        // wThreadNum = new Text(gDetails, SWT.BORDER);
        // wThreadNum
        // .setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.ThreadPool.Level1.Tooltip"));
        // props.setLook(wThreadNum);
        // FormData fdThreadNum = new FormData();
        // fdThreadNum.top = new FormAttachment(wlLogLevel, 4);
        // fdThreadNum.width = 20;
        // fdThreadNum.left = new FormAttachment(wThreadPoolLevel, 5);
        // wThreadNum.setLayoutData(fdThreadNum);
        // wThreadNum.addVerifyListener(new VerifyListener() {
        // public void verifyText(VerifyEvent e) {
        // boolean b = ("0123456789".indexOf(e.text) >= 0);
        // e.doit = b;
        // }
        // });
        //
        // wlPerformanceLevel = new Label(gDetails, SWT.NONE);
        // props.setLook(wlPerformanceLevel);
        // wlPerformanceLevel.setText(
        // BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.ThreadPool.PerformanceLevel.Label"));
        // wlPerformanceLevel.setToolTipText(
        // BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.ThreadPool.PerformanceLevel.Tooltip"));
        // FormData fdlPerformanceLevel = new FormData();
        // fdlPerformanceLevel.top = new FormAttachment(wThreadPool, 7);
        // fdlPerformanceLevel.left = new FormAttachment(27, 0);
        // wlPerformanceLevel.setLayoutData(fdlPerformanceLevel);
        //
        // wPerformanceLevel = new CCombo(gDetails, SWT.READ_ONLY | SWT.BORDER);
        // wPerformanceLevel.setToolTipText(
        // BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.ThreadPool.PerformanceLevel.Tooltip"));
        // props.setLook(wPerformanceLevel);
        // FormData fdPerformanceLevel = new FormData();
        // fdPerformanceLevel.top = new FormAttachment(wThreadPool, 5);
        // fdPerformanceLevel.width = 185;
        // fdPerformanceLevel.left = new FormAttachment(wlPerformanceLevel, 5);
        // wPerformanceLevel.setLayoutData(fdPerformanceLevel);
        // wPerformanceLevel.setItems(EtlThreadPool.threadPoolPerformanceLevelWords);
        //
        // wAddAutoCopy = new Button( gDetails, SWT.CHECK );
        // wAddAutoCopy.setText( BaseMessages.getString( PKG, "TransExecutionConfigurationDialog.AddStepCopy.Label" ) );
        // wAddAutoCopy.setToolTipText( BaseMessages.getString( PKG,
        // "TransExecutionConfigurationDialog.AddStepCopy.Tooltip" ) );
        // props.setLook( wAddAutoCopy );
        // FormData fdAddAutoCopy = new FormData();
        // fdAddAutoCopy.top = new FormAttachment( 0, 10 );
        // fdAddAutoCopy.left = new FormAttachment( 74, 0 );
        // wAddAutoCopy.setLayoutData( fdAddAutoCopy );
        // wAddAutoCopy.addSelectionListener(new SelectionListener() {
        //
        // @Override
        // public void widgetSelected(SelectionEvent arg0) {
        // // TODO Auto-generated method stub
        // if(wAddAutoCopy.getSelection()){
        // wEnableInputGroup.setEnabled(true);
        // wRmoveAutoCopy.setSelection(false);
        // wAutomaticOptimizationStep.setEnabled(false);
        // }else if(!wRmoveAutoCopy.getSelection()){
        // wAutomaticOptimizationStep.setEnabled(true);
        // wEnableInputGroup.setSelection(false);
        // wEnableInputGroup.setEnabled(false);
        // wGroupNum.setEnabled(false);
        // wGroupNum.setText("");
        // }else{
        // wEnableInputGroup.setSelection(false);
        // wEnableInputGroup.setEnabled(false);
        // wGroupNum.setEnabled(false);
        // wGroupNum.setText("");
        //
        // }
        //
        // }
        //
        // @Override
        // public void widgetDefaultSelected(SelectionEvent arg0) {
        // // TODO Auto-generated method stub
        //
        // }
        // });
        //
        // wRmoveAutoCopy = new Button(gDetails, SWT.CHECK);
        // wRmoveAutoCopy.setText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.RMStepCopy.Label"));
        // wRmoveAutoCopy
        // .setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.RMStepCopy.Tooltip"));
        // props.setLook(wRmoveAutoCopy);
        // FormData fdRMAutoCopy = new FormData();
        // fdRMAutoCopy.top = new FormAttachment(wAddAutoCopy, 7);
        // fdRMAutoCopy.left = new FormAttachment(74, 0);
        // wRmoveAutoCopy.setLayoutData(fdRMAutoCopy);
        // wRmoveAutoCopy.addSelectionListener(new SelectionListener() {
        //
        // @Override
        // public void widgetSelected(SelectionEvent arg0) {
        // // TODO Auto-generated method stub
        // if (wRmoveAutoCopy.getSelection()) {
        // wAddAutoCopy.setSelection(false);
        // wEnableInputGroup.setSelection(false);
        // wEnableInputGroup.setEnabled(false);
        // wGroupNum.setEnabled(false);
        // wAutomaticOptimizationStep.setEnabled(false);
        // } else if (!wAddAutoCopy.getSelection()) {
        // wAutomaticOptimizationStep.setEnabled(true);
        // }
        //
        // }
        //
        // @Override
        // public void widgetDefaultSelected(SelectionEvent arg0) {
        // // TODO Auto-generated method stub
        //
        // }
        // });
        //
        // wEnableInputGroup = new Button(gDetails, SWT.CHECK);
        // wEnableInputGroup
        // .setText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.EnableInputGroup.Label"));
        // props.setLook(wEnableInputGroup);
        // FormData fdEnableInputGroup = new FormData();
        // fdEnableInputGroup.top = new FormAttachment(wRmoveAutoCopy, 7);
        // fdEnableInputGroup.left = new FormAttachment(74, 0);
        // wEnableInputGroup.setLayoutData(fdEnableInputGroup);
        // wEnableInputGroup.setEnabled(false);
        // wEnableInputGroup.addSelectionListener(new SelectionListener() {
        //
        // @Override
        // public void widgetSelected(SelectionEvent paramSelectionEvent) {
        // // TODO Auto-generated method stub
        // if (wEnableInputGroup.getSelection()) {
        // wGroupNum.setEnabled(true);
        // } else {
        // wGroupNum.setEnabled(false);
        // wGroupNum.setText("");
        // }
        //
        // }
        //
        // @Override
        // public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) {
        // // TODO Auto-generated method stub
        // }
        // });
        //
        // wGroupNum = new Text(gDetails, SWT.BORDER);
        // wGroupNum.setToolTipText(BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.GroupNum.Tooltip"));
        // props.setLook(wGroupNum);
        // FormData fdwGroupNum = new FormData();
        // fdwGroupNum.top = new FormAttachment(wRmoveAutoCopy, 4);
        // fdwGroupNum.width = 20;
        // fdwGroupNum.left = new FormAttachment(wEnableInputGroup, 5);
        // wGroupNum.setLayoutData(fdwGroupNum);
        // wGroupNum.setEnabled(false);
        // wGroupNum.addVerifyListener(new VerifyListener() {
        // public void verifyText(VerifyEvent e) {
        // boolean b = ("0123456789".indexOf(e.text) >= 0);
        // e.doit = b;
        // }
        // });
        //
        // wAutomaticOptimizationStep = new Button(gDetails, SWT.CHECK);
        // wAutomaticOptimizationStep.setText("★");
        // wAutomaticOptimizationStep.setToolTipText(
        // BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.AutomaticOptimizationStep.Tooltip"));
        // props.setLook(wAutomaticOptimizationStep);
        // FormData fdAutomaticOptimizationStep = new FormData();
        // fdAutomaticOptimizationStep.top = new FormAttachment(0, 10);
        // fdAutomaticOptimizationStep.left = new FormAttachment(95, 0);
        // wAutomaticOptimizationStep.setLayoutData(fdAutomaticOptimizationStep);
        // wAutomaticOptimizationStep.addSelectionListener(new SelectionListener() {
        //
        // @Override
        // public void widgetSelected(SelectionEvent paramSelectionEvent) {
        // // TODO Auto-generated method stub
        // if (wAutomaticOptimizationStep.getSelection()) {
        // wAddAutoCopy.setSelection(false);
        // wAddAutoCopy.setEnabled(false);
        // wRmoveAutoCopy.setSelection(false);
        // wRmoveAutoCopy.setEnabled(false);
        // wEnableInputGroup.setSelection(false);
        // wEnableInputGroup.setEnabled(false);
        // wGroupNum.setEnabled(false);
        // wGroupNum.setText("");
        // wThreadPool.setSelection(false);
        // wThreadPool.setEnabled(false);
        // wThreadPoolLevel.deselectAll();
        // wThreadPoolLevel.setEnabled(false);
        // wThreadNum.setText("");
        // wThreadNum.setVisible(false);
        // wlPerformanceLevel.setEnabled(false);
        // wPerformanceLevel.setEditable(false);
        // wPerformanceLevel.deselectAll();
        // } else {
        // wAddAutoCopy.setEnabled(true);
        // wRmoveAutoCopy.setEnabled(true);
        // wThreadPool.setEnabled(true);
        // }
        //
        // }
        //
        // @Override
        // public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) {
        // // TODO Auto-generated method stub
        //
        // }
        // });

    }

    public boolean open() {

        mainLayout(PKG, "TransExecutionConfigurationDialog", GUIResource.getInstance().getImageTransGraph());
        runConfigurationSectionLayout(PKG, "TransExecutionConfigurationDialog");
        optionsSectionLayout(PKG, "TransExecutionConfigurationDialog");
        parametersSectionLayout(PKG, "TransExecutionConfigurationDialog");

        String docUrl =
            Const.getDocUrl(BaseMessages.getString(Spoon.class, "Spoon.TransExecutionConfigurationDialog.Help"));
        String docTitle = BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.docTitle");
        String docHeader = BaseMessages.getString(PKG, "TransExecutionConfigurationDialog.docHeader");
        buttonsSectionLayout(PKG, "TransExecutionConfigurationDialog", docTitle, docUrl, docHeader);

        getData();
        openDialog();
        return retval;
    }

    private void getVariablesData() {
        wVariables.clearAll(false);
        List<String> variableNames = new ArrayList<String>(configuration.getVariables().keySet());
        Collections.sort(variableNames);

        for (int i = 0; i < variableNames.size(); i++) {
            String variableName = variableNames.get(i);
            String variableValue = configuration.getVariables().get(variableName);

            if (Const.indexOfString(variableName, abstractMeta.listParameters()) < 0) {

                TableItem tableItem = new TableItem(wVariables.table, SWT.NONE);
                tableItem.setText(1, variableName);
                tableItem.setText(2, Const.NVL(variableValue, ""));
            }
        }
        wVariables.removeEmptyRows();
        wVariables.setRowNums();
        wVariables.optWidth(true);
    }

    public void getData() {
        wSafeMode.setSelection(configuration.isSafeModeEnabled());
        wClearLog.setSelection(configuration.isClearingLog());
        wGatherMetrics.setSelection(configuration.isGatheringMetrics());
        // wThreadPool.setSelection(configuration.isThreadPool());

        List<String> runConfigurations = new ArrayList<>();
        try {
            ExtensionPointHandler.callExtensionPoint(Spoon.getInstance().getLog(),
                KettleExtensionPoint.SpoonRunConfiguration.id, new Object[] {runConfigurations, TransMeta.XML_TAG});
        } catch (KettleException e) {
            // Ignore errors
        }

        wRunConfiguration.setItems(runConfigurations.toArray(new String[0]));
        if (!runConfigurations.contains(getConfiguration().getRunConfiguration())) {
            getConfiguration().setRunConfiguration(null);
        }
        if (Utils.isEmpty(getConfiguration().getRunConfiguration())) {
            wRunConfiguration.select(0);
        } else {
            wRunConfiguration.setText(getConfiguration().getRunConfiguration());
        }

        // wLogLevel.select(configuration.getLogLevel().getLevel());
        wLogLevel.select(DefaultLogLevel.getLogLevel().getLevel());

        // if (configuration.isThreadPool()) {
        // wThreadPoolLevel.select(configuration.getThreadPoolLevel());
        // wPerformanceLevel.select(configuration.getPerformanceLevel());
        // if (null != configuration.getThreadNum()) {
        // wThreadNum.setText(configuration.getThreadNum().toString());
        // }
        // if (wThreadPoolLevel.getSelectionIndex() == EtlThreadPool.cachedThreadPool) {
        // wThreadNum.setText("");
        // wThreadNum.setVisible(false);
        // }
        // } else {
        // wThreadPoolLevel.setEnabled(false);
        // wThreadNum.setVisible(false);
        // wlPerformanceLevel.setEnabled(false);
        // wPerformanceLevel.setEnabled(false);
        // }

        getParamsData();
        getVariablesData();
    }

    public void getInfo() {
        // int ncpus = Runtime.getRuntime().availableProcessors();// 获取机器cpu核心数
        try {
            configuration.setReplayDate(null); // removed from new execution dialog.
            // getConfiguration().setRunConfiguration(wRunConfiguration.getText());

            configuration.setSafeModeEnabled(wSafeMode.getSelection());
            configuration.setClearingLog(wClearLog.getSelection());
            configuration.setLogLevel(LogLevel.values()[wLogLevel.getSelectionIndex()]);
            DefaultLogLevel.setLogLevel(LogLevel.values()[wLogLevel.getSelectionIndex()]);
            configuration.setGatheringMetrics(wGatherMetrics.getSelection());
            // configuration.setThreadPool(wThreadPool.getSelection());// 获取线程池是否启用
            // configuration.setThreadPoolLevel(wThreadPoolLevel.getSelectionIndex());// 获取线程池类型
            // Integer tmpThreadNum = (int)(ncpus * 2 - 2);// 默认线程数
            // if (null != wThreadNum.getText() && !wThreadNum.getText().isEmpty()) {
            // tmpThreadNum = Integer.parseInt(wThreadNum.getText());
            // }
            // configuration.setThreadNum(tmpThreadNum);// 获取定常线程池线程数
            // configuration.setPerformanceLevel(wPerformanceLevel.getSelectionIndex());// 是否关闭性能模式
            // configuration.setAddAutoCopy(wAddAutoCopy.getSelection());// 判断是否勾选生成复制配置
            // configuration.setRmoveAutoCopy(wRmoveAutoCopy.getSelection());// 判断是否勾选清除复制配置
            // configuration.setEnableInputGroup(wEnableInputGroup.getSelection());
            // Integer tmpGroup = (int)(ncpus / 2 + 1);// 默认分组数
            // if (null != wGroupNum.getText() && !wGroupNum.getText().isEmpty()) {
            // tmpGroup = Integer.parseInt(wGroupNum.getText());
            // }
            // configuration.setGroupNum(tmpGroup);// 获取输入分组
            // configuration.setAutomaticOptimizationStep(wAutomaticOptimizationStep.getSelection());// 判断此模式是否选择
            // The lower part of the dialog...
            getInfoParameters();
            getInfoVariables();
        } catch (Exception e) {
            new ErrorDialog(shell, "Error in settings", "There is an error in the dialog settings", e);
        }
    }

    /**
     * @return the configuration
     */
    public TransExecutionConfiguration getConfiguration() {
        return (TransExecutionConfiguration)configuration;
    }
}
